/*
 * IndexNode woud keep all the necessary information of 
 * 
 * 
 * */



import java.util.*;


public class IndexNode {
	
	private int occur;
	private Double tf;
	private Double tf_idf;
	private List<Integer> positionArray;
	
	public IndexNode(){
		
		this.occur=0;
		this.tf=0.0;
		this.tf_idf=0.0;
		this.positionArray=new ArrayList<Integer>();
	}
	
    public void add(int position ){
    
    	this.occur++;
    	positionArray.add(position);
    	
    }
    
    public void caltf(int length){
    	
    	double temp= this.occur/(double)length;
    	
    	this.tf=(double)temp;
    }
    public double get_tf(){
    	return this.tf;
    }
    
    public void set_tf_idf(Double idf){
    	
    	this.tf_idf=this.tf*idf;
    	
    	// System.out.println("this is:"+this.tf_idf);
    }
    public List<Integer> get_positionArray(){
    	return this.positionArray;
    }
    public Double get_tf_idf(){
    	
    	return this.tf_idf;
    }
    public String toString(){
    	
    	String result= "the result is:";
    	for(Integer i: positionArray){
    		
    		result=result+i+"\t";
    	}
    	return result;
    }
    public int get_occur(){
    	return this.occur;
    }
}
